Skip to content

Add binary sensor to Nord Pool#169684

Open
gjohansson-ST wants to merge 2 commits intodevfrom
gj-20260503-01
Open

Add binary sensor to Nord Pool#169684
gjohansson-ST wants to merge 2 commits intodevfrom
gj-20260503-01

Conversation

@gjohansson-ST
Copy link
Copy Markdown
Member

@gjohansson-ST gjohansson-ST commented May 3, 2026

Breaking change

Proposed change

Adds binary sensor to Nord Pool

  • Tomorrow price available as diagnostic sensor

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • I have followed the [perfect PR recommendations][perfect-pr]
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for [www.home-assistant.io][docs-repository]

If the code communicates with devices, web services, or third-party tools:

  • The [manifest file][manifest-docs] has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

  • I have reviewed two other [open pull requests][prs] in this repository.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Nord Pool integration by adding a new diagnostic binary sensor that indicates whether tomorrow’s prices are available, along with coordinator support and test coverage for the new platform.

Changes:

  • Add a binary_sensor platform with a tomorrow_price_available diagnostic entity per configured area.
  • Extend the coordinator with a helper to access tomorrow’s delivery period data.
  • Update Nord Pool tests and snapshots to load platforms selectively and validate the new binary sensor behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
homeassistant/components/nordpool/binary_sensor.py Adds the new diagnostic binary sensor platform and entity implementation.
homeassistant/components/nordpool/coordinator.py Adds get_data_tomorrow() accessor used by the binary sensor.
homeassistant/components/nordpool/const.py Registers the binary_sensor platform in PLATFORMS.
homeassistant/components/nordpool/strings.json Adds the binary sensor translation key/name.
tests/components/nordpool/conftest.py Adds platform patching fixture to load only selected platforms per test.
tests/components/nordpool/test_sensor.py Ensures sensor tests load only the sensor platform.
tests/components/nordpool/test_binary_sensor.py Adds snapshot tests for binary sensor on/off scenarios.
tests/components/nordpool/snapshots/test_sensor.ambr Updates snapshot names due to new parametrization.
tests/components/nordpool/snapshots/test_binary_sensor.ambr Adds snapshots for the new binary sensor entities.

Comment thread homeassistant/components/nordpool/binary_sensor.py Outdated
Comment thread homeassistant/components/nordpool/binary_sensor.py Outdated
Comment thread tests/components/nordpool/test_binary_sensor.py Outdated
Comment thread homeassistant/components/nordpool/coordinator.py Outdated
@erwindouna
Copy link
Copy Markdown
Member

"Tomorrow price available as diagnostic sensor", would it it be odd to expect an update in the diagnostics ambr file? :)

) -> bool:
"""Return tomorrow price availability.

Output: True or False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Output: True or False

It's a bool return type that is obvious

Output: True or False
"""
data = entity.coordinator.get_data_tomorrow()
if data and data.entries and entity.area in data.entries[0].entry:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if data and data.entries and entity.area in data.entries[0].entry:
return (data and data.entries and entity.area in data.entries[0].entry)

A bit more concise imo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants